package com.qumoyugo.springframework.beans.factory.config;

import com.qumoyugo.springframework.beans.BeansException;
import com.qumoyugo.springframework.beans.PropertyValues;

public interface InstantiationAwareBeanPostProcessor extends BeanPostProcessor {

    /**
     * 在Bean对象初始化之前执行的方法
     * @param beanClass
     * @param beanName
     * @return
     * @throws BeansException
     */
    Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException;

    /**
     * 在Bean对象初始化之后执行的方法
     * @param bean
     * @param beanName
     * @return
     * @throws BeansException
     */
    boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException;

    /**
     * 在Bean对象实例化完成之后，设置属性之前执行
     * @param propertyValues
     * @param bean
     * @param beanName
     * @return
     * @throws BeansException
     */
    PropertyValues postProcessPropertyValues(PropertyValues propertyValues, Object bean, String beanName) throws BeansException;

    /**
     * 获取早期引用
     * @param exposedObject
     * @param beanName
     * @return
     */
    Object getEarlyBeanReference(Object exposedObject, String beanName);
}
